Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose db memory address and path to libduckdb_java.so V2 #115

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Jens-H
Copy link
Contributor

@Jens-H Jens-H commented Dec 29, 2024

This PR replaces #87!

Same idea, but:

  • using Java long instead of String to hold the memory address
  • based on top of main HEAD

I read that DuckDB uses pointer swizzling, which should break before there is problem with the uintptr_t -> jlong cast. This means it should be OK to use it on all supported platforms.

@Jens-H
Copy link
Contributor Author

Jens-H commented Dec 29, 2024

I ran make format and committed some unrelated files and lines with dc0833a ... seems like without much success.

@Jens-H
Copy link
Contributor Author

Jens-H commented Jan 2, 2025

To add a rational for this change:
Since Java 22 the JEP 454 "Foreign Function & Memory API" left the preview status (https://openjdk.org/jeps/454) and is now the second official way to interact with native code.
This would open the option to use the faster C API (like columnar access) instead of the traditional JDBC methods. As JDBC is everywhere it should be possible to have both. Unfortunately the Duckdb database pointer is not accessible outside JNI. With the new method it is possible to rebuild the pointer when needed.

@Mause You reviewed the old PR, so maybe you can have a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant